IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MachineMSInstalledComponents]') AND type in (N'U'))
BEGIN
     DROP TABLE [dbo].[MachineMSInstalledComponents]
END
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[MachineMSInstalledComponents](
     [MachineMSInstalledComponentsId] [int] IDENTITY(1,1) NOT NULL,
     [MachineId]                      [int]               NOT NULL,
     [PackageExecutionId]             [bigint]            NOT NULL,
     [ServiceName]                    [varchar](128)      NOT NULL,
     [InstanceName]                   [varchar](128)      NOT NULL,
     [InstalledComponentName]         [varchar](30)       NOT NULL,
     [IsClusteredFlag]                [tinyint]           NOT NULL,
     [SrvrInstncId]                   [int]                   NULL,
     [RelatedToSrvrInstncId]          [int]                   NULL,
     [InstalledComponentDeletedFlag]  [tinyint]           NOT NULL,
     [LastModDt]                      [datetime]          NOT NULL,
     CONSTRAINT [PK_MachineMSInstalledComponents] PRIMARY KEY CLUSTERED ( [MachineMSInstalledComponentsId] ASC )
) ON [PRIMARY]
GO

SET ANSI_PADDING OFF
GO

CREATE UNIQUE NONCLUSTERED INDEX [IX_MachineMSInstalledComponents_MachineId_ServiceName] ON [dbo].[MachineMSInstalledComponents] 
     ( [MachineId] ASC, [ServiceName] ASC ) ON [Data_Index]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MachineMSInstalledComponents', @level2type=N'COLUMN',@level2name=N'InstalledComponentDeletedFlag'
GO
